export function getPortsGroup(direction) {
    // 创建 portsIn 和 portsOut 的副本
    const portsIn = {
        position: {
            name: 'right'
        },
        attrs: {
            portBody: {
                magnet: true,
                r: 0,
                fill: '#023047',
                stroke: '#023047'
            }
        },
        label: {
            position: {
                name: 'right',
                args: { y: -8 }
            },
            markup: [{
                tagName: 'text',
                selector: 'label',
                attributes: {
                    'font-size': '12', // 设置字体大小
                    'fill': '#333333'  // 设置字体颜色
                }
            }]
        },
        markup: [{
            tagName: 'circle',
            selector: 'portBody'
        }]
    };

    const portsOut = {
        position: {
            name: 'left'
        },
        attrs: {
            portBody: {
                magnet: true,
                r: 0,
                stroke: '#023047'
            }
        },
        label: {
            position: {
                name: 'left',
                args: { y: -8 },
            },
            markup: [{
                tagName: 'text',
                selector: 'label',
                attributes: {
                    'font-size': '12', // 设置字体大小
                    'fill': '#333333'  // 设置字体颜色
                }
            }]
        },
        markup: [{
            tagName: 'circle',
            selector: 'portBody'
        }]
    };

    // 根据传入的 direction 修改位置
    if (direction === 'right') {
        portsIn.position.name = 'left';
        portsIn.label.position.name = 'left';
        portsOut.position.name = 'right';
        portsOut.label.position.name = 'right';
    } else if (direction === 'left') {
        portsIn.position.name = 'right';
        portsIn.label.position.name = 'right';
        portsOut.position.name = 'left';
        portsOut.label.position.name = 'left';
    }
    return {
        'in': portsIn,
        'out': portsOut,
    };
}
